package org.stvd.service.logs.impl;

import java.util.Date;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.stvd.core.dto.QueryResult;
import org.stvd.core.util.DateUtil;
import org.stvd.core.util.IdWorker;
import org.stvd.entities.logs.SysLoginInfo;
import org.stvd.repository.logs.SysLoginInfoDao;
import org.stvd.service.base.impl.BaseServiceImpl;
import org.stvd.service.logs.SysLoginInfoService;

/**
 * @Title: SysLoginInfoServiceImpl
 * @Description: 系统登录日志业务层实现类
 * @author houzx
 * @date 2020年9月2日
 */
@Service("SysLoginInfoService")
public class SysLoginInfoServiceImpl extends BaseServiceImpl<SysLoginInfo> implements SysLoginInfoService{

    @Resource(name="SysLoginInfoDao")
    private SysLoginInfoDao sysLoginInfoDao;
    
    @Override
    public void insertLoginInfo(SysLoginInfo loginInfo) {
        if(loginInfo!=null) {
            loginInfo.setInfoId(IdWorker.getInstance().nextId());
            loginInfo.setLoginTime(DateUtil.getSystemDate());
            sysLoginInfoDao.insert(loginInfo);
        }
    }

    @Override
    public QueryResult<SysLoginInfo> queryLginInfoResult(int start, int limit,
        String userName, String status, String ipaddr, Date queryStartDate, Date queryEndDate) {
        return sysLoginInfoDao.queryLginInfoResult(start, limit, userName, status, ipaddr, queryStartDate, queryEndDate);
    }

}
